﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Common;
using AspNetCs.Bll;


public partial class AncestralHallList : BasePage
{
    private int pageSize = 20;
    protected int recodCount = 0;
    private int province = 0;
    private int city = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        DnsRequest.UrlRequestAgentName(out city, out province);
        if (!IsPostBack)
        {
            BindReapter();
        }
    }


    public void BindReapter()
    {
        string cmdText = "select id,AncestralHallId,createname=(select username from users where userid=me.CreateId ),CreateTime,AcceeCount,Name from AncestralHall as me where IsCheck=1 and Isdel=0 " + DnsRequest.WhereString("province", "city", " and ", this.city, this.province) + " order by AcceeCount desc,CreateTime desc";
        DataPagesOperate operate = new DataPagesOperate();
        AspNetPager1.PageSize = pageSize;
        operate.BindRepeater(cmdText, AspNetPager1, "AcceeCount desc,CreateTime desc", "id", rptList, out recodCount);

    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        BindReapter();
    }
    protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            if (rptList.Items.Count <= 0)
            {
                Panel pl = e.Item.FindControl("Pl_Nothing") as Panel;
                pl.Visible = true;
            }
        }
    }
    public override string UI_TopControl()
    {

        return base.UI_TopControl(true, city, province);
    }
    public override string UI_Head()
    {
        return base.UI_Head(configInfo.SiteTitle, configInfo.Meta_Keywords, configInfo.Meta_Description, city, province);
    }

    
}
